package com.orm;

import javax.persistence.*;
import javax.persistence.Entity;

/**
 * Created by lirance on 16/4/6.
 */
@Entity
@Table(name = "serviceCalled", schema = "", catalog = "ServiceRecommendationSystem")
@IdClass(ServiceCalledEntityPK.class)
public class ServiceCalledEntity extends com.orm.Entity{
    private int uId;
    private int wsId;
    private int rtt;
    private int dataSize;
    private Integer resCode;
    private String resMessage;
    private int frequency;

    @Id
    @Column(name = "uId", nullable = false, insertable = true, updatable = true)
    public int getuId() {
        return uId;
    }

    public void setuId(int uId) {
        this.uId = uId;
    }

    @Id
    @Column(name = "wsId", nullable = false, insertable = true, updatable = true)
    public int getWsId() {
        return wsId;
    }

    public void setWsId(int wsId) {
        this.wsId = wsId;
    }

    @Id
    @Column(name = "rtt", nullable = false, insertable = true, updatable = true)
    public int getRtt() {
        return rtt;
    }

    public void setRtt(int rtt) {
        this.rtt = rtt;
    }

    @Id
    @Column(name = "dataSize", nullable = false, insertable = true, updatable = true)
    public int getDataSize() {
        return dataSize;
    }

    public void setDataSize(int dataSize) {
        this.dataSize = dataSize;
    }

    @Basic
    @Column(name = "resCode", nullable = true, insertable = true, updatable = true)
    public Integer getResCode() {
        return resCode;
    }

    public void setResCode(Integer resCode) {
        this.resCode = resCode;
    }

    @Basic
    @Column(name = "resMessage", nullable = true, insertable = true, updatable = true, length = 255)
    public String getResMessage() {
        return resMessage;
    }

    public void setResMessage(String resMessage) {
        this.resMessage = resMessage;
    }

    @Basic
    @Column(name = "frequency", nullable = false, insertable = true, updatable = true)
    public int getFrequency() {
        return frequency;
    }

    public void setFrequency(int frequency) {
        this.frequency = frequency;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ServiceCalledEntity that = (ServiceCalledEntity) o;

        if (uId != that.uId) return false;
        if (wsId != that.wsId) return false;
        if (rtt != that.rtt) return false;
        if (dataSize != that.dataSize) return false;
        if (frequency != that.frequency) return false;
        if (resCode != null ? !resCode.equals(that.resCode) : that.resCode != null) return false;
        if (resMessage != null ? !resMessage.equals(that.resMessage) : that.resMessage != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = uId;
        result = 31 * result + wsId;
        result = 31 * result + rtt;
        result = 31 * result + dataSize;
        result = 31 * result + (resCode != null ? resCode.hashCode() : 0);
        result = 31 * result + (resMessage != null ? resMessage.hashCode() : 0);
        result = 31 * result + frequency;
        return result;
    }
}
